using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using T2.WebSecurity.Data.Controllers.Interfaces;
using T2.WebSecurity.Data.Entities.Interfaces;
using T2.WebSecurity.Business.Entities.Interfaces;
using T2.WebSecurity.Business.Entities;
using T2.WebSecurity.Business.Builders;
using T2.WebSecurity.Business.Directors.Interface;
using T2.WebSecurity.Business.Entities.Search.Interfaces;

//--Change Management Control - PasswordQuestion Director  --**********************
//--Created By: trooks
//--Description: PasswordQuestion Director Class
//--Created Date: 03/07/2013 10:49:01
//--*************************************************************

namespace T2.WebSecurity.Business.Directors
{
	public partial class PasswordQuestion_Director_biz : IPasswordQuestion_director_biz
	{
		
		public List<IPasswordQuestion_biz> Construct (IPasswordQuestion_biz _param, bool BuildUp, bool BuildDown)
		{
			PasswordQuestion_Builder build = new PasswordQuestion_Builder();
			List<IPasswordQuestion_biz> retVal = build.BuildParts(_param);
			foreach(IPasswordQuestion_biz item in retVal)
			{
				item.Membership_List = BuildMembershipList(item, false, BuildDown);
		}
			return retVal;
		}
		public List<IPasswordQuestion_biz> Construct (IPasswordQuestionSearch_biz _param, bool BuildUp, bool BuildDown)
		{
			PasswordQuestion_Builder build = new PasswordQuestion_Builder();
			List<IPasswordQuestion_biz> retVal = build.BuildParts(_param);
			foreach(IPasswordQuestion_biz item in retVal)
			{
				item.Membership_List = BuildMembershipList(item, false, BuildDown);
		}
			return retVal;
		}
		private List<IMembership_biz> BuildMembershipList(IPasswordQuestion_biz _param, bool BuildUp, bool BuildDown)
		{
			List<IMembership_biz> retVal = new List<IMembership_biz>();
			if(BuildDown)
			{
			IMembership_biz MembershipParam = new Membership_biz();
			MembershipParam.Action ="PasswordQuestion_Membership_ByParent";
			MembershipParam.PageNumber = 1;
			MembershipParam.PageSize = 100;
			MembershipParam.SortType = "asc";
			MembershipParam.SortColumn = "MembershipID";
			MembershipParam.PasswordQuestionID = _param.PasswordQuestionID;
			Membership_Builder builder = new Membership_Builder();
			retVal = builder.BuildParts(MembershipParam);
			}
			return retVal;
		}
	}
}